//
//  PolicyModel.m
//  carcareIOS
//
//  Created by ileo on 16/7/27.
//  Copyright © 2016年 chezheng. All rights reserved.
//

#import "PolicyModel.h"
#import "CalendarMgr.h"
@implementation PolicyModel

- (void)setStatus:(NSInteger)status
{
    _status = status;

    self.canClickLookDetailPolicy = YES;
    //0,未提交验证消息 1,验证图片中 2,验证消息中 3,验证失败 4,自动验证成功 5,人工验证成功(无保单详情)
    switch (status) {
        case 0:
            self.statusImageName = @"willTestPolicyImage";
            self.canClickHeadCell = YES;
            break;
        case 1:
            self.statusImageName = @"willTestPolicyImage";
            self.canClickHeadCell = NO;
            break;
        case 3:
            self.statusImageName = @"failTestPolicyImage";
            self.canClickHeadCell = YES;
            break;
        case 4:
            self.statusImageName = @"";
            self.canClickHeadCell = NO;
            break;
        case 5:

            self.statusImageName = @"";
            self.canClickLookDetailPolicy = NO;
            self.canClickHeadCell = NO;
            break;
        default:
            break;
    }
}
- (void)setExpireDate:(NSString *)expireDate
{
    _expireDate = expireDate;
    
    NSInteger expireDateInt = [CalendarMgr daysFromDate:[NSDate date] toDate:[CALENDARMGR dateWithStr:expireDate format:yyyy_MM_dd]];
    self.expireDateStr = (expireDateInt > 0 ? [NSString stringWithFormat:@"剩余%zd天到期",expireDateInt] : @"");
}
@end
